<template>
	<view class="content">
		<div class="user_box">
			<div class="user_l">
				<!-- <img src="../../static/index_top.png" alt=""> -->
			</div>
			<div class="user_r">
				<div class="user_name">
					齐琨
				</div>
				<div class="user_id">
					ID 371248
				</div>
			</div>
		</div>
		<div class="list">
			<div class="list_item">个人资料</div>
			<div class="list_item" @click="goCardlist">名片夹</div>
			<div class="list_item" @click="goMyOrganization">我的组织</div>
			<div class="list_item">我的活动</div>
			<div class="list_item">我的帖子</div>
			<div class="list_item">申请信息</div>
			<div class="list_item" @click="feedback">意见反馈</div>
			<div class="list_item" @click="service">客服电话</div>
		</div>
		<uni-popup ref="popup" type="dialog">
			<uni-popup-dialog :duration="2000" :before-close="true" @close="close"
				@confirm="confirm">18910631923</uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script>
	import request from '@/request/index.js'
	export default {
		data() {
			return {

			}
		},
		onShow() {
			console.log(uni.getStorageSync('token'))
			//重新获取用户信息
			this.getuser()
			// if(uni.getStorageSync('token')){

			// }else{
			// 	uni.navigateTo({
			// 		url:'/pages/login/login'
			// 	})
			// }
		},
		methods: {
			getuser() {
				//api/users/getUserInfo
				request.post({
					header: {
						access_token: uni.getStorageSync('token')
					},
					url: '/api/users/getUserInfo',
					success: res => {
						if (res.code == 200) {
							console.log('用户信息:', res.result)
							// that.swiper_Data = res.result
						}
					}
				})
			},
			goMyOrganization() {
				uni.navigateTo({
					url: '/pages/My_Organization/My_Organization'
				})
			},
			goCardlist() {
				uni.navigateTo({
					url: '/pages/Card_list/Card_list'
				})
			},
			feedback() {
				uni.navigateTo({
					url: '/pages/feedback/feedback'
				})
			},
			service() {
				console.log('center')
				this.$refs.popup.open('center')
			},
			close() {
				// TODO 做一些其他的事情，before-close 为true的情况下，手动执行 close 才会关闭对话框
				// ...
				this.$refs.popup.close()
			},
			confirm() {
				this.$refs.popup.close()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.user_box {
		height: 375rpx;
		width: 100%;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		padding: 60rpx 40rpx;

		.user_l {
			img {
				width: 136rpx;
				height: 136rpx;
				border-radius: 50%;
			}
		}

		.user_r {
			margin-left: 28rpx;

			.user_name {
				font-size: 40rpx;
				line-height: 58rpx;
				color: #333333;
			}

			.user_id {
				font-size: 28rpx;
				line-height: 40rpx;
				color: #666666;
			}
		}
	}

	.list {
		width: 100%;
		border-radius: 30rpx 30rpx 0 30rpx;
		box-sizing: border-box;
		padding: 40rpx;
		padding-top: 0;

		.list_item {
			border-bottom: 2rpx solid #D8D8D8;
			font-size: 28rpx;
			color: #333333;
			height: 120rpx;
			line-height: 120rpx;
		}
	}
</style>